package pe.edu.unmsm.pacis.shca.service.impl;

import java.util.HashMap;
import java.util.Map;

import org.apache.log4j.Logger;
import org.springframework.stereotype.Service;

import pe.edu.unmsm.pacis.shca.ams.BaseAgentService;
import pe.edu.unmsm.pacis.shca.ams.impl.BaseAgentServiceImpl;
import pe.edu.unmsm.pacis.shca.domain.entity.User;
import pe.edu.unmsm.pacis.shca.domain.exception.DomainException;
import pe.edu.unmsm.pacis.shca.service.AgentService;

@Service
public class AgentServiceImpl extends BaseAgentServiceImpl implements AgentService {
	
	private static final Logger logger = Logger.getLogger(AgentServiceImpl.class);
	
	private String REMOTE_AGENT_NAME = "loginAgent";
	
	public AgentServiceImpl(){
		super();
		setRemoteAgent(this.REMOTE_AGENT_NAME);
	}
	
	public User loginValidate() throws DomainException{
		Map<String, Object> sendMap = new HashMap<String, Object>();
		sendMap.put("login", "myuser");
		sendMap.put("password", "mypassword");
		Map<String, Object> replyMap = executeCommand(sendMap);
		User user = (User)replyMap.get("user");
		return user;
	}
	
}
